﻿
// EntialiasingView.h: CEntialiasingView 类的接口
//

#pragma once
#include "CPoint2D.h"

class CEntialiasingView : public CView
{
protected: // 仅从序列化创建
	CEntialiasingView() noexcept;
	DECLARE_DYNCREATE(CEntialiasingView)

// 特性
public:
	CEntialiasingDoc* GetDocument() const;

// 操作
public:
	void DrawLine();
	void DrawLineVertical(CDC* pDC);
	void DrawLineHorizontal(CDC* pDC);
	void DrawLineSlopeMoreThan1(CDC* pDC, float slope);
	void DrawLineSlopeBetweenNagt1WithPosi1(CDC* pDC, float slope);
	void DrawLineSlopeLessThanNagt1(CDC* pDC, float slope);

	void CalRGB(int x, int xDist, CRGB& cStart, CRGB& cEnd, CRGB& cCurr);
	void CalNeighborRGB(float ratio, CRGB& cReal, CRGB& cLeftOrBottom, CRGB& cRightOrTop);

// 重写
public:
	virtual void OnDraw(CDC* pDC);  // 重写以绘制该视图
	virtual BOOL PreCreateWindow(CREATESTRUCT& cs);
protected:
	virtual BOOL OnPreparePrinting(CPrintInfo* pInfo);
	virtual void OnBeginPrinting(CDC* pDC, CPrintInfo* pInfo);
	virtual void OnEndPrinting(CDC* pDC, CPrintInfo* pInfo);

// 实现
public:
	virtual ~CEntialiasingView();
#ifdef _DEBUG
	virtual void AssertValid() const;
	virtual void Dump(CDumpContext& dc) const;
#endif

protected:
	CPoint2D pStart;
	CPoint2D pEnd;

// 生成的消息映射函数
protected:
	DECLARE_MESSAGE_MAP()
public:
	afx_msg void OnLButtonDown(UINT nFlags, CPoint point);
	afx_msg void OnLButtonUp(UINT nFlags, CPoint point);
};

#ifndef _DEBUG  // EntialiasingView.cpp 中的调试版本
inline CEntialiasingDoc* CEntialiasingView::GetDocument() const
   { return reinterpret_cast<CEntialiasingDoc*>(m_pDocument); }
#endif

